๐๏ธGitะฏัะฐ๐๏ธ
Node / meshtastic / Meshtastic-Android / files / core / repository / src / commonMain / kotlin / org / meshtastic / core / repository / RadioController.kt
Displaying Raw โข Download
core/repository/src/commonMain/kotlin/org/meshtastic/core/repository/RadioController.kt 65a1f5ce4d0e4b8eafcd0bbfccafd41dc6ee888a (65a1f5ce) Text, 4.75 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.repository
Tff7b72import T7ee787kotlinx.coroutines.flow.StateFlow
Tff7b72import T7ee787org.meshtastic.proto.Channel
Tff7b72import T7ee787org.meshtastic.proto.ClientNotification
Tff7b72import T7ee787org.meshtastic.proto.Config
T8b949e/**
* Central interface for controlling the radio and mesh network.
*
* This is a composite interface that extends the focused sub-interfaces below. Feature modules that need the full
* surface inject [RadioController]; modules that need only a subset can inject the narrower interface for better
* testability and clearer dependency intent.
*
* **Sub-interfaces (mirrors SDK's layered API design):**
* - [AdminController] โ config, channels, owner, device lifecycle (โ SDK `AdminApi`)
* - [MessagingController] โ send packets, reactions, contacts (โ SDK `RadioClient.send*`)
* - [NodeController] โ favorite, ignore, mute, remove nodes (โ SDK `AdminApi` node ops)
* - [QueryController] โ telemetry, traceroute, position queries (โ SDK `TelemetryApi` / `RoutingApi`)
*
* When migrating to the SDK, each sub-interface becomes a thin adapter over the corresponding SDK API. The composite
* [RadioController] can then be deprecated and consumers migrated to the narrower interfaces one at a time.
*/
Tff7b72interface T56d364RadioController Tb4b4b4:
Te6edf3AdminControllerTb4b4b4,
Te6edf3MessagingControllerTb4b4b4,
Te6edf3NodeControllerTb4b4b4,
Te6edf3QueryControllerTb4b4b4,
Te6edf3ConnectionStateProvider Tb4b4b4{
T8b949e/**
* Flow of notifications from the radio client.
*
* These represent high-level events like "Handshake completed" or "Channel configuration updated."
*/
Tff7b72val Te6edf3clientNotificationTb4b4b4: Te6edf3StateFlowTff7b72<Te6edf3ClientNotification?Tff7b72>
T8b949e/** Monotonic transport-session generation used to reject work captured by a replaced connection. */
Tff7b72val Te6edf3sessionGenerationTb4b4b4: Te6edf3StateFlowTff7b72<Tffa657LongTff7b72>
T8b949e/** Clears the current [clientNotification]. */
Tff7b72fun Td2a8ffclearClientNotificationTb4b4b4(Tb4b4b4)
T8b949e/**
* Generates a unique packet ID for a new request.
*
* @return A unique 32-bit integer.
*/
Tff7b72fun Td2a8ffgeneratePacketIdTb4b4b4(Tb4b4b4)Tb4b4b4: Tffa657Int
T8b949e/**
* Restores local radio settings only while [expectedDeviceAddress] is still selected.
*
* The selection check and the edit-settings transaction are serialized with [setDeviceAddress], so a delayed
* recovery task cannot apply one device's saved settings to a replacement radio. A concurrent device selection
* waits for the serialized edit-settings transaction to finish. [primaryChannel] is written before [config] when
* present, and both writes are idempotent for the same captured device/configuration so a failed attempt can be
* retried. If the channel write is accepted and the config write then fails, firmware may temporarily retain that
* staged channel state until the transaction is retried or the connection is replaced; callers must re-check
* selection ownership before every retry. Returns `false` without writing when [expectedDeviceAddress] is null or
* selection ownership has changed.
*/
Tff7b72suspend Tff7b72fun Td2a8ffrestoreLocalConfigurationTb4b4b4(
Te6edf3expectedDeviceAddressTb4b4b4: Tffa657String?Tb4b4b4,
Te6edf3configTb4b4b4: Te6edf3ConfigTb4b4b4,
Te6edf3primaryChannelTb4b4b4: Te6edf3Channel? Tff7b72= Tff7b72nullTb4b4b4,
Tb4b4b4)Tb4b4b4: Tffa657Boolean
T8b949e/** Starts providing the phone's location to the mesh. */
Tff7b72fun Td2a8ffstartProvideLocationTb4b4b4(Tb4b4b4)
T8b949e/** Stops providing the phone's location to the mesh. */
Tff7b72fun Td2a8ffstopProvideLocationTb4b4b4(Tb4b4b4)
T8b949e/**
* Changes the device address (e.g., BLE MAC, IP address) we are communicating with.
*
* Suspends until the database has been switched, the in-memory node DB cleared, and the transport reconfigured.
* Callers that depend on the device switch being effective before their next call (e.g. OTA disconnect-then-delay
* sequences) can rely on this ordering.
*
* @param address The new device identifier.
*/
Tff7b72suspend Tff7b72fun Td2a8ffsetDeviceAddressTb4b4b4(Te6edf3addressTb4b4b4: Tffa657StringTb4b4b4)
T8b949e/**
* Requests that the next BLE connection invalidates Android's GATT service cache. Call before [setDeviceAddress]
* when reconnecting after a firmware update.
*/
Tff7b72fun Td2a8ffrequestGattCacheInvalidationOnNextConnectTb4b4b4(Tb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.05s